
/*
 * @Author: luoqi
 * @Date: 2022-03-29 16:53:25
 * @LastEditors: luoqi
 * @LastEditTime: 2022-03-29 18:07:51
 * @Description: 
 */
import React from 'react';
import { Button, } from 'antd';
import style from './recharge.module.css'
import { ExportOutlined } from '@ant-design/icons';

import { exportExcel} from 'xlsx-oc';


const Export = (props) => {

  //导出excel
  function exportFn() {
    //数据、列名、文件名
    const {data,header,fileName}=props
    //列名
    let _header=[]
    header.forEach(item=>{
      _header.push({
        k:item.key,
        v:item.title
      })
    })
  exportExcel(_header, data,fileName);

  }
  return (
    <div>
      <Button type="primary" htmlType="submit" onClick={exportFn} icon={<ExportOutlined />} className={style.export} >
        导出
      </Button>
    </div>
  );
}

export default Export;
